﻿using Microsoft.AspNetCore.Mvc;
using AbpVnext_Module.Iservice;
using AbpVnext_Module.Dto;
using Volo.Abp.Identity;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace Ebusiness_Seckills.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SeckillsController : ControllerBase
    {
        public IProductImageService ProductImageService { get; set; }

        public IIdentityUserAppService IdentityUserAppService { get; set; }
                
        // GET: api/<SeckillsController>
        [HttpGet]
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<SeckillsController>/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
            return "value";
        }

        /// <summary>
        /// 动态C#客户端测试
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ProductImageDto> TestProxyApi()
        {
            //https://localhost:5272/aaa/projects/productimage/get?id=1
            var data = await ProductImageService.GetAsync(1);
            IdentityUserDto identityUserDto = await IdentityUserAppService.FindByUsernameAsync("");
            return data;
        }

        // POST api/<SeckillsController>
        [HttpPost]
        public async Task<ProductImageDto> Post([FromBody] string value)
        {
            var data = await ProductImageService.GetAsync(1);
            return data;
        }
    }
}
